'''
Company: TWL
Author: xue jian
Email: xuejian@kanzhun.com
Date: 2020-11-07 16:36:42
'''
#
# @lc app=leetcode.cn id=384 lang=python3
#
# [384] 打乱数组
#

# @lc code=start
from typing import List
import copy
import random
class Solution:

    def __init__(self, nums: List[int]):
        self.store = nums
        self.shuf = copy.copy(nums)

    def reset(self) -> List[int]:
        """
        Resets the array to its original configuration and return it.
        """
        self.shuf = copy.copy(self.store)
        return self.store




    def shuffle(self) -> List[int]:
        """
        Returns a random shuffling of the array.
        """
        for i in range(len(self.shuf)):
            j = random.randint(i, len(self.shuf)-1)
            self.shuf[i], self.shuf[j] = self.shuf[j], self.shuf[i]
        return self.shuf



# Your Solution object will be instantiated and called as such:
# obj = Solution(nums)
# param_1 = obj.reset()
# param_2 = obj.shuffle()
# @lc code=end

